The invention is generally related to computers and computer software. More specifically, the invention is generally related to optimizing retrieval and execution of executable files on a computer system.
Computer technology continues to be applied to new applications to handle more useful and complex tasks. Despite the continual advances in the speed and power of computers, however, these new applications of computer technology continue to demand even greater computing power. For this reason, an ever-present need exists for improving the performance of the computer software that controls how a computer operates.
It has been found that the greatest performance can typically be obtained using computer software formatted in a native language for a particular computer""s hardware. Specifically, all computers include at the most basic level one or more processors that process sequences of instructions (known as program code) that are formatted in a specific language that is directly understood by the processors. If it is desired to execute program code that is written in another language, that program code must first be translated into native format understood by the particular processor.
Computer software is typically written in a human-readable format known as source code. If the source code is written in a compiled language such as c or c++, the source code may be translated, or compiled, into native machine-readable program code using a computer program called a compiler. The compiled source code, often referred to as object code, may also be optimized using various compilation techniques. The compilation process is typically tailored for a particular computer hardware configuration, known as a platform, so that the resulting object code is native to the platform for optimum performance. As a result, compiled object code is often limited to execution on a single computer platform.
While object code from a compiled language is typically compiled prior to execution on a computer, it is also possible to perform dynamic translation of source code during program code execution using a process called interpretation, e.g., as found with interpretative computer languages such as basic. However, translating program code from one format to another can significantly affect the performance of a computer due to the additional processing that is required to perform the translation process before program code can be executed. As a result, interpretative program code is often not a viable option for many performance-critical applications.
Due to the growing popularity of the Internet, and of networking in general, computers of all types and from all over the world are being interconnected together, in part to permit program code to be distributed and used on different computers. However, due to differences between the hardware configurations of different computers, it is often difficult to distribute compiled program code to a specific computerxe2x80x94especially when the sending computer is not aware of the particular platform of the destination computer.
It would be desirable in many situations to be able to distribute and execute computer software on any computer regardless of its particular platform. As a result, computer software languages such as Java have been developed that attempt to partially bridge the gap between purely interpretative and compiled languages by producing program code that is xe2x80x9cplatform independentxe2x80x9d and can be executed on a wide variety of computer platforms.
With Java, for example, source code is compiled into sequences of bytecodes, stored in class files, that are formatted in a language that is native to a xe2x80x9cvirtualxe2x80x9d platform or machine. To execute compiled Java program code on a specific computer platform, a Java Virtual Machine (JVM) computer program (which includes a Java interpreter) is required to dynamically translate the platform-independent program code in class files into native program code for the platform. Thus, as long as a computer has a suitable JVM for its particular platform, the computer can execute a Java program.
While the performance of Java program code is often superior to that of a purely interpretative language, the performance often significantly lags that of a compiled language since translation of Java bytecodes into native program code is still required at run-time. While Java is capable of directly calling relatively faster native methods in a computer, the use of such methods often destroys platform-independence, and is thus unsuitable for use in many applications.
Significant development efforts have been expended in the area of xe2x80x9cjust-in-timexe2x80x9d compilation, where Java bytecodes are compiled into native piogram code when they are first loaded into a computer, and then are maintained in the computer memory during run-time so that subsequent execution is performed principally using native program code. However, just-in-time compilers often produce poor program code since they operate on Java bytecodes only after a class file is loaded, and thus must compile quickly so as to avoid excessive delay in the loading operation.
Another manner of increasing performance with a platform-independent language is the use of a xe2x80x9cfatxe2x80x9d file that allows pre-compiled native p gram code to be stored along with a file containing platform-independent program code. For example, with a Java fat file, native program code corresponding to a Java class may be stored at the end of a class file. Detection of the existence of this program code is performed by determining if the actual length of the file is greater than the length indicated in the file header. Thus, if native program code is detected, the native version of the program code may be executed in lieu of the platform-independent version, often with improved performance.
However, incorporating native and platform-independent program code using a fat file requires modification of the original platform-independent file. Consequently, there is a risk that the file will lose its platform-independence and fail to execute properly on other platforms. Moreover, to create a fat file a user must be granted write access to the original file, which may not be practical or advisable in many situations. Compilation must also be performed as an explicit step requiring explicit actions by the user, and as a result, dynamically transmitted files often may never be capable of benefitting from the potential performance improvements of pre-compilation. complilation, In addition, the integrity checking (if any) of the file during runtime is often insufficient, and a risk exists that the file may be damaged during an update or that the native program code may be out of date if it was not also up dated in response to an update of the platform-independent program code in the file.
Consequently, a significant need continues to exist for a manner of improving the performance of computer software program code. Moreover, with respect to platform-independent languages such as Java, a significant need continues to exist for a manner of improving performance without sacrificing platform-independence.
The invention addresses these and other problems associated with the prior art by providing a computer system, program product, and method in which alternate program code is associated with an executable file using a file attribute so that the alternate program code may be retrieved and executed in appropriate circumstances. A file attribute may include practically any parameter associated with a file other than its actual contents. File attributes are conventionally utilized by file management systems to store information about files, e.g., creation date, last date modified, access rights, descriptions or alternate names, etc. File attributes are typically handled separately by a file management system, and cannot be updated directly by modifying the contents of the filesxe2x80x94that is, file attributes are often hidden from normal file input/output operations.
By associating alternate program code with an executable file using a file attribute, the alternate program code is more transparent to the user, as well as to conventional execution modules that are not specifically configured to detect and execute the alternate program code. Moreover, system write access is often not required for a user, so that the integrity of the original executable program code can be protected.
While the invention may be used to improve performance in a wide variety of other applications, one important application of the invention is in associating native program code with an executable file containing platform-independent program code, e.g., a Java class file. Given that program code associated with a file attribute is typically transparent to conventional Java interpreters, the performance of a Java or other platform-independent computer program may be enhanced for operation on a particular platform while maintaining platform-independence.
An executable file is generally considered to include a first set of program code. Consistent with one aspect of the invention, a computer system, program product, and method may be provided where such a file is retrieved, a second set of program code is generated from the first set of program code, and the second set of program code is associated with the file using a file attribute. Consistent with another aspect of the invention, a computer system, program product, and method may be provided where a file attribute of such a file may be analyzed to detect existence of the second set of program code so that the second set of program code may be retrieved.
These and other advantages and features, which characterize the invention, are set forth in the claims annexed hereto and forming a further part hereof. However, for a better understanding of the invention, and of the advantages and objectives attained through its use, reference should be made to the Drawing, and to the accompanying descriptive matter, in which there is described exemplary embodiments of the invention.